var _iframeManager; 

function onLoaded() {
    window.setTimeout(function() {
        var qs = new QueryString();

        jQuery('#HappyHour-app').val(qs.Get('app', 1));
        jQuery('#HappyHour-owner').val(qs.Get('owner', 3));
        jQuery('#HappyHour-viewer').val(qs.Get('viewer', 1));
        jQuery('#HappyHour-widgetUrl').val(qs.Get('uri', 'containerspy.xml'));
        jQuery('#HappyHour-surface').val(qs.Get('surface', 'profile')); 

        var strParms = qs.Get('parms', '{}');

        _iframeManager = new HappyHourManager();    
        _iframeManager.initParameters();
        _iframeManager.initContainer();
        
        window._gadgetLoaded = false;
        window._viewParameters = gadgets.json.parse(strParms); 

        if (window == parent) {
            return;
        }
        else {
            parent.iframeLoaded(window);
        } 
    }, 800);
};

function loadContent(content, mgr) { 
    var widgetDiv = jQuery('#HappyHour-widgetContent');
	_iframeManager.injectGadgetHTML(widgetDiv, content);
};